home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20000217-20000824
/
000114_news@columbia.edu _Tue Mar 14 10:43:34 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2000-08-23
|
5KB
Return-Path: <news@columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id KAA26945
for <kermit.misc@watsun.cc.columbia.edu>; Tue, 14 Mar 2000 10:43:34 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id KAA25832
for kermit.misc@watsun.cc.columbia.edu; Tue, 14 Mar 2000 10:29:43 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Subject: Re: Sockets programming: telnet problem.
Date: 14 Mar 2000 15:29:42 GMT
Organization: Columbia University
Message-ID: <8allt6$p76$1@newsmaster.cc.columbia.edu>
To: kermit.misc@columbia.edu
In article <8ak6qk$qse$1@nnrp1.deja.com>, <jamescurry@my-deja.com> wrote:
: Ok, I'm attempting to write a (very) basic telnet client as an
: experiment. Actually, I'm using it to connect to various talkers,
: NUTS based which don't do very much in following the telnet protocol.
: (They seem to ignore or treat as CR any control codes, in fact the
: only code they ever DO seem to send is the echo control when it's
: time to enter a password).
: My program is sending data out in a character based manner (as soon
: as a key is pressed, sent it with write() over the socket) and
: reading in as much data as it can at once with read(), using select()
: to check if there is any data to be read on the socket. The problem
: is as follows: when a NUTS talker displays a prompt such as "give me
: a name:" on it's login screen, or COM> which is a command prompt, this
: line is NOT terminated by a carriage return, as it's a prompt and the
: user who is telnetting in is meant to make their input on the same
: line. However, these prompts simply aren't seen by my program. In
: fact, neither select() or read() are aware of the existence of this
: line until at least one character has been sent back the other way!
: Therefore, I don't see the "give me a name:" prompt until I press the
: first letter of my name, which then appears not to be displayed as
: the prompt appears on top of it. After reading through the details
: of the telnet protocol, I figured that maybe I needed to do something
: strange like send a GA code. But 255, 249 isn't recognised by the
: talkers, which appears to worsen matters.
: So HELP!!! What am I doing wrong? How can I get my program to see
: these unterminated prompts before it sends any output back to the
: server.
:
There really is no longer any reason for everybody to write their own
Telnet implementation from the ground up. It's all been done for you
already in C-Kermit:
http://www.columbia.edu/kermit/ckermit.html
This is a Telnet client that:
. Includes its own programming language, allowing you to write your
application at a high level without needing to know a thing about
Telnet protocol details, NVTs, etc.
. Runs on every known variety of UNIX, as well as on VMS, VOS, AOS/VS,
and other platforms.
. Has compatible companion programs for Windows, DOS, OS/2, etc.
. Offers lots of other services including file transfer and management,
character-set translation, etc, on the Telnet connection.
. Also can make other kinds of connections: dialed, Rlogin, and on some
platforms X.25, LAT, etc.
As you describe your application, it could be programmed very simply about
like this:
.myname = joedoaks
set host someserver.com /telnet
if fail exit 1 {Can't make connection}
input 10 {give me a name:}
if fail exit 1 {No name prompt}
lineout \m(myname)
.\%n = 0
while true {
input 10 {COM>}
if fail {
increment \%n
if ( > \%n 10 ) exit 1 {Timeout waiting for command prompt}
echo WARNING: Missing command prompt - trying again...
lineout
continue
} else {
.\%n = 0
(do whatever you wanted to do here...)
}
}
As you can see, the Telnet details are completely transparent to your
program. Therefore the same script can easily be adapted to other
communication methods. And it can also be run on hundreds of different
platforms with little or no modification.
To see lots of sample Kermit scripts, visit:
http://www.columbia.edu/kermit/ckscripts.html
To find out about all that Kermit's telnet client is doing for you
behind the scenes, see:
http://www.columbia.edu/kermit/telnet.html
- Frank